import Vue from "vue";
import Router from 'vue-router';

import Index from "@/views/Index.vue";
import Login from "@/views/Login.vue";

Vue.use(Router);

export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [{
            path: '/',
            name: 'login',
            component: Login,
            meta: {
                title: '登录'
            }
        },
        {
            path: '/index',
            name: 'index',
            component: Index,
            children: [{
                    path: '/index/',
                    name: 'Home',
                    component: resolve => require(['./views/index/Home.vue'], resolve),
                    // component: () => import('./views/index/Home.vue')
                    // component: Home
                    meta: {
                        title: '首页'
                    }
                },
                {
                    path: '/index/WriteAnEssay',
                    name: 'WriteAnEssay',
                    component: resolve => require(['./views/index/WriteAnEssay.vue'], resolve),
                    meta: {
                        title: '发布新的文章'
                    }
                    // component: () => import('./views/index/WriteAnEssay.vue')

                    // component: WriteAnEssay
                }, {
                    path: '/index/Article/List',
                    name: 'ArticleList',
                    component: resolve => require(['./views/index/Article/List'], resolve),
                    meta: {
                        title: '文章列表'
                    }
                    // component: () => import('./views/index/Article/List')
                    // component: ArticleList
                },
                {
                    path: '/index/Article/WasteBasket',
                    name: 'WasteBasket',
                    component: () => import("./views/index/Article/WasteBasket"),
                    meta: {
                        title: '废纸篓'
                    }
                    // component: () => import('./views/index/Article/WasteBasket')
                },
                {
                    path: '/index/Classification/List',
                    name: 'ClassificationList',
                    // component: resolve => require(['./views/index/Classification/List'],resolve)
                    component: () => import('./views/index/Classification/List'),
                    meta: {
                        title: '分类列表'
                    }
                }, {
                    path: '/index/Classification/Add',
                    name: 'ClassificationAdd',
                    component: resolve => require(['./views/index/Classification/Add'], resolve),
                    meta: {
                        title: '添加分类'
                    }
                    // component: () => import('./views/index/Classification/Add')
                },
                {
                    path: '/index/Label/List',
                    name: 'LabelList',
                    // component: resolve => require(['./views/index/Label/List'],resolve)
                    component: () => import('./views/index/Label/List'),
                    meta: {
                        title: '标签列表'
                    }
                }, {
                    path: '/index/Label/Add',
                    name: 'LabelAdd',
                    component: resolve => require(['./views/index/Label/Add'], resolve),
                    meta: {
                        title: '添加标签'
                    }
                    // component: () => import('./views/index/Label/Add')
                }, {
                    path: '/index/Comment/List',
                    name: 'CommentList',
                    component: resolve => require(['./views/index/Comment/List'], resolve),
                    meta: {
                        title: '管理评论'
                    }
                    // component: () => import('./views/index/Comment/List')
                }, { //站点管理
                    path: '/index/SiteManagement',
                    name: 'SiteManagement',
                    component: resolve => require(['./views/index/SiteManagement'], resolve),
                    meta: {
                        title: '系统管理'
                    }
                    // component: () => import('./views/index/SiteManagement')
                },
            ]
        }
    ]
});